package com.ruoyi.asms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.asms.domain.Inspection;
import com.ruoyi.asms.mapper.InspectionMapper;
import com.ruoyi.asms.service.IInspectionService;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 巡检信息Service业务层处理
 * 
 * @author yfkj
 * @date 2021-10-21
 */
@Service
public class InspectionServiceImpl extends ServiceImpl<InspectionMapper, Inspection>  implements IInspectionService
{
    @Autowired
    private InspectionMapper inspectionMapper;

    /**
     * 查询巡检信息
     * 
     * @param inspectionId 巡检信息主键
     * @return 巡检信息
     */
    @Override
    public Inspection selectInspectionByInspectionId(Long inspectionId)
    {
        return inspectionMapper.selectInspectionByInspectionId(inspectionId);
    }

    /**
     * 查询巡检信息列表
     * 
     * @param inspection 巡检信息
     * @return 巡检信息
     */
    @Override
    public List<Inspection> selectInspectionList(Inspection inspection)
    {
        return inspectionMapper.selectInspectionList(inspection);
    }

    /**
     * 新增巡检信息
     * 
     * @param inspection 巡检信息
     * @return 结果
     */
    @Override
    public int insertInspection(Inspection inspection)
    {
        inspection.setCreateTime(System.currentTimeMillis());
        inspection.setCreateBy(SecurityUtils.getUsername());
        return inspectionMapper.insertInspection(inspection);
    }

    /**
     * 修改巡检信息
     * 
     * @param inspection 巡检信息
     * @return 结果
     */
    @Override
    public int updateInspection(Inspection inspection)
    {
        inspection.setUpdateTime(System.currentTimeMillis());
        inspection.setUpdateBy(SecurityUtils.getUsername());

        return inspectionMapper.updateInspection(inspection);
    }

    /**
     * 批量删除巡检信息
     * 
     * @param inspectionIds 需要删除的巡检信息主键
     * @return 结果
     */
    @Override
    public int deleteInspectionByInspectionIds(Long[] inspectionIds)
    {
        return inspectionMapper.deleteInspectionByInspectionIds(inspectionIds);
    }

    /**
     * 删除巡检信息信息
     * 
     * @param inspectionId 巡检信息主键
     * @return 结果
     */
    @Override
    public int deleteInspectionByInspectionId(Long inspectionId)
    {
        return inspectionMapper.deleteInspectionByInspectionId(inspectionId);
    }
}
